#ifndef MD5DEEPER_H
#define MD5DEEPER_H

#include <QtGui>

class md5deeper : public QWidget
{
	Q_OBJECT

public:
	md5deeper(QWidget *parent = 0);
	QString clipboardText();
	QString hashType(QString) const;

private:
	enum statusMessage {openFileError, fileNameEmpty, hashEmpty,
						invalidHash, invalidFileName, saveSuccess,
						hashMatch, hashMismatch};
	QMap<QString, int> hashLengths;

	QPushButton *openTargetFileButton;
	QPushButton *verifyButton;
	QPushButton *saveButton;
	QLineEdit *targetFileText;
	QLineEdit *hashText;
	QLabel *targetFileLabel;
	QLabel *statusMessageLabel;
	QComboBox *hashMenu;
//	QTimer *timer;

	bool validHash(QString) const;
	bool validPath(QString) const;
	bool write(QString, QString); // Returns boolean indicating write success/failure
	bool checkUserErrors();
	bool comboMatchesInput();

public slots:
	void save();
	void verify();
	void openTargetFile();

private slots:
	void displayMessage(statusMessage);
	void displayMessage(QProcess::ProcessError);
	void showMessage(QString, bool=false);
	void updateHashMenu(QString);
	virtual void dragEnterEvent(QDragEnterEvent *event);
	virtual void dropEvent(QDropEvent *event);
	void clearMessage();
};

#endif // MD5DEEPER_H
